package per.ethan.springboot.example.schedule;

import cn.hutool.core.date.DateUtil;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author Ethan
 * @date 2020/06/07 11:40
 */
@Component
public class ScheduleDemo {

    @Scheduled(cron = "0/2 * * * * ?")
    public void scheduleMethod() {
        System.out.println("schedule定时器触发：" + DateUtil.formatLocalDateTime(LocalDateTime.now()));
    }

}
